//    Copyright (C) Kherty.  All rights reserved.
using System;

namespace OpenLS.Spreadsheet
{
    class WorkbookCalculationDisabler : IDisposable
    {
        public WorkbookCalculationDisabler(Workbook wb)
        {
            workbook = wb;
            mode = wb.CalculationProperties.CalculationMode;
            wb.CalculationProperties.CalculationMode = CalculationMode.Manual;
        }

        readonly CalculationMode mode;
        Workbook workbook;
        #region IDisposable Members

        public void Dispose()
        {
            workbook.CalculationProperties.CalculationMode = mode;
        }

        #endregion
    }
}
